package com.ft.oa.web.presalesController;

import com.ft.oa.domain.dto.ApiResult;
import com.ft.oa.domain.technology.Technology;
import com.ft.oa.service.technologyService.ItechnologyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/technology")
public class TechnologyController {

    @Autowired
    private ItechnologyService itechnologyService;
    /**
     * 添加技术领域信息
     */
    @PostMapping("/addtechlogy")
    private ApiResult addtechlogy(@RequestBody Technology technology){
       return ApiResult.builder().code(200).msg("添加成功").data(itechnologyService.addtechlogy(technology)).build();
    }
    /**
     * 获取技术领域总数量
     */
    @PostMapping("/techall")
    private ApiResult techall(){
        return ApiResult.builder().code(200).msg("技术领域总数量").data(itechnologyService.techall()).build();
    }
    /**
     * 获取客户目标总数量
     */
    @PostMapping("/techsnum")
    public ApiResult techsnum(){
        return ApiResult.builder().code(200).msg("客户目标总数").data(itechnologyService.techsnum()).build();
    }
    /**
     * 删除技术领域维护信息
     */
    @GetMapping("delltech")
    public ApiResult delltech(@RequestParam int techid){
        return ApiResult.builder().code(200).msg("删除成功").data(itechnologyService.delltech(techid)).build();
    }
    /**
     * 编辑技术领域信息
     */
    @PostMapping("/updatetech")
    private ApiResult updatetech(@RequestBody Technology technology){
        return ApiResult.builder().code(200).msg("更新成功").data(itechnologyService.updatetech(technology)).build();
    }
    /**
     * 查询行业维护的基本信息
     * @return
     */
    @GetMapping("/technolist")
    public ApiResult list(@RequestParam(required = false)String rqjsname, int page, int size){
        return ApiResult.builder().code(200).msg("技术领域返回成功").data( itechnologyService.viewtechology(rqjsname, page, size)).build();
    }
    /**
     * 获取技术领域
     */
    @GetMapping("/viewTechnology")
    private ApiResult viewIndustry(@RequestParam String id){
        return ApiResult.successWithData(itechnologyService.viewTechnology(id));
    }
}
